package taskmanager;

import taskinstance.*;

/**
 * @author ryan
 * Task factory to create different type of task.
 * 
 * Task type:
 *   1. Instant task: the task will run immediately.
 *   2. Timing task:  the task will run until the time.
 *   3. Period task:  the task will run period according to the time cycle.
 */
public class TaskFactory {
  public static Task createTask(String sourceIp, String targetIp, String fileName,
      String attribute, int type) {
    switch (type) {
      case 0:
        return new InstantTask(sourceIp, targetIp, fileName);
      case 1:
        return new TimingTask(sourceIp, targetIp, fileName, attribute);
      case 2:
        return new PeriodTask(sourceIp, targetIp, fileName, attribute);
    }
    return new Task();  // can't get here
  }
}
